import { FishActionObject } from "./FishActionObject";
import { FishBaseController } from "../ObjController/FishBaseController";
import { SWFPlayer } from "../../../../scene/modle/SWFPlayer";
import { TimelineLite } from "../../../../../../com/greensock/TimelineLite";
import { TweenLite } from "../../../../../../com/greensock/TweenLite";
type int = number;
//class Obstacle
    
    export  class Obstacle extends FishActionObject
    {
        constructor(arg1: FishBaseController, arg2: SWFPlayer=null)
        {
            super(arg1, arg2);
            this.minDepth = 80;
            this.maxDepth = 120;
            return;
        }

        public get isInShake(): Boolean
        {
            return this._isInShake;
        }

        public shake(arg1: number=0.1): void
        {
            var totalTime: number=0.1;
            var oldX: number;
            var oldY: number;
            var timeLite: TimelineLite;
            var i: int;

            var loc1;
            oldX = NaN;
            timeLite = null;
            totalTime = arg1;
            if (this._isInShake) 
            {
                return;
            }
            this._isInShake = true;
            oldX = x;
            oldY = y;
            timeLite = new TimelineLite();
            i = 0;
            while (i < int(totalTime / 0.2)) 
            {
                timeLite.append(new TweenLite(this, 0.1, {"x": oldX - 15}));
                timeLite.append(new TweenLite(this, 0.1, {"x": oldX + 15}));
                ++i;
            }
            timeLite.append(new TweenLite(this, 0.1, {"x": oldX - 15}));
            timeLite.append(new TweenLite(this, 0.1, {"x": oldX - 5, "onComplete":(): void
            {
                x = oldX;
                _isInShake = false;
                timeLite.stop();
                timeLite = null;
                return;
            }}))
            timeLite.play();
            return;
        }

        /* internal */ /* var */_isInShake: Boolean=false;
    }
